<template>
  <div class="box_sex">
    <div class="title">
      <p>男女比例</p>
      <img src="../../images/dataScreen-title.png" alt="">
    </div>
    <div class="sex">
      <div class="man">
        <p class="man_text">男生</p>
        <img src="../../images/man.png" alt="">
      </div>
      <div class="women">
        <p class="woman_text">女生</p>
        <img src="../../images/woman.png" alt="">
      </div>
    </div>
    <div class="rate">
      <p>男生60%</p>
      <p>女生40%</p>
    </div>
    <div class="charts" ref="charts">

    </div>
  </div>
</template>
<script setup lang='ts' name='sex'>
import * as echarts from 'echarts'
import { onMounted, ref } from 'vue';
let charts = ref()
onMounted(() => {
  let mycharts = echarts.init(charts.value)
  mycharts.setOption({
    series: [
      {
        type: 'bar',
        data: [60],
        barWidth:20,
        z:100,//层级
        itemStyle:{
          color:'blue',
          borderRadius:20
        }
      },
      {
        type:'bar',
        data:[100],
        barWidth:20,
        barGap:'-100%',//图标位置
        itemStyle:{
          color:'pink',
          borderRadius:20
        }
      }
    ],
    xAxis: {
      show: false,
      min: 0,
      max: 100,
    },
    yAxis: {
      show: false,
      type: "category"
    },
    grid: {
      top: 0,
      left: "10%",
      right: "10%",
      bottom: 0
    }
  })
})


</script>


<style scoped>
.box_sex {
  width: 100%;
  height: 100%;
  background: url(../../images/dataScreen-main-cb.png) no-repeat;
  background-size: 100% 100%;
  margin: 20px 0px;

  .title {
    color: white;
    font-size: 20px;
    margin-left: 20px;
  }

  .sex {
    display: flex;
    justify-content: center;

    .man {
      margin: 20px;
      width: 111px;
      height: 115px;
      background: url(../../images/man-bg.png) no-repeat;
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      .man_text{
        color: white;
        padding-bottom: 32px;
      }
    }

    .women {
      margin: 20px;
      width: 111px;
      height: 115px;
      background: url(../../images/woman-bg.png) no-repeat;
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      .woman_text{
        color: white;
        padding-bottom: 32px;
      }
    }
  }

  .rate {
    color: white;
    display: flex;
    justify-content: space-evenly;
    gap: 70px;
    align-items: center;
    font-size: 20px;
  }

  .charts {
    height: 100px;
  }
}
</style>